#@layout()

#define js()
    <script>
    $(function(){
        var _table;
        _table =$("#user-list").DataTable( {
            aLengthMenu:[10,20,50],
            "processing": true,
            "serverSide": true,
            "bLengthChange": false,
            "bSort":false,
            "bStateSave":true,
            searching: false,//屏蔽datatales的查询框
            "pagingType":   "full_numbers",
            "ajax":{
                "url": "/admin/user/listAll",
                "type": "post",
                "data": function (params) {
                        params["user.mobile"]=$("#mobile").val();
                        params["user.status"]=$("#status").val();
                }
            },
            "columns": [
                    { "data": "id" },
                    { "data": "mobile" },
                    { "data": "status" },
                    { "data": "create_time" },
                { "data": function(data){
                   var opt="<a href='javascript:;' onclick='del("+data.id+")'>删除</a>|";
                    opt+="<a href='javascript:;' onclick='lock("+data.id+")'>锁定</a>|";
                    opt+="<a href='javascript:;' onclick='log("+data.id+")'>操作日志</a>|";
                    opt+="<a href='javascript:;' onclick='unlock("+data.id+")'>解锁</a>";
                    return opt;
                }
                }
            ]
        } );
        $("#searchBtn").click(function(){
            _table.ajax.reload();
        });
});
    /*编辑*/
    function edit(id){
        var title="编辑";
        var w="";
        var h=510;
        layer_show(title,url,w,h);
    }
    /*添加*/
    function add(){
        var title="添加";
        var url="#(contextPath)/admin/user/add/";
        var w="";
        var h=510;
        layer_show(title,url,w,h);
    }

    /*删除*/
    function del(id){
        var config = {
        "url":"#(contextPath)/admin/user/deleteById?id="+id,
        data:{}
        };
        var backendTool = new BackendTool(config);
        backendTool.ajaxRequest();
    }
    
    /*锁定*/
    function lock(id){
        var config = {
        "url":"#(contextPath)/admin/user/lock?id="+id,
        data:{}
        };
        var backendTool = new BackendTool(config);
        backendTool.ajaxRequest();
    }
    
    /*解锁*/
    function unlock(id){
        var config = {
        "url":"#(contextPath)/admin/user/unlock?id="+id,
        data:{}
        };
        var backendTool = new BackendTool(config);
        backendTool.ajaxRequest();
    }
    
    
    /*操作日志*/
    function log(id){
        var title="操作日志";
        var url="#(contextPath)/admin/opertion/queryLog?id="+id+"&taskType=3";
        var w="";
        var h=510;
        layer_show(title,url,w,h);
    }
    </script>
#end

#define main()
    #@breadcrumb(["广告主管理","广告主列表"])
   <div class="page-container">
       <div class="text-c">
           <input type="text" name="user.mobile" id="mobile" placeholder="请输入用户手机号码检索..." style="width:350px" class="input-text">
           <span class="select-box inline">
			<select name="user.status" class="select" id="status">
				<option value="-1">账户状态</option>
				<option value="1">正常使用</option>
				<option value="0">帐号锁定</option>
			</select>
			</span>
           <button name="" id="searchBtn" class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i>检索</button>
       </div>
       #--
       <div class="cl pd-5 bg-1 bk-gray mt-20">
		    <span class="l">
		        <a href="javascript:;" onclick="add()" class="btn btn-primary radius">添加</a>
		    </span>
           <span class="r">
       </div>
       --#
       <div class="mt-20">
           <table class="table table-border table-bordered table-bg table-hover table-sort" id="user-list">
               <thead>
               <tr class="text-c">
                     <th>id</th>
                     <th>手机号</th>
                     <th>状态</th>
                     <th>创建时间</th>
                   <th>操作</th>
               </tr>
               </thead>
               <tbody>
               </tbody>
           </table>
       </div>
   </div>
#end